package cn.xsly.ymcc.fegin;

import cn.xsly.ymcc.doc.CourseDoc;
import cn.xsly.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchFeginFactory implements FallbackFactory<SearchFeginClient> {
    @Override
    public SearchFeginClient create(Throwable cause) {
        return new SearchFeginClient() {
            @Override
            public JSONResult save(CourseDoc doc) {
                cause.printStackTrace();
                return JSONResult.error("es添加课程不可用");
            }

            @Override
            public JSONResult delete(CourseDoc doc) {
                cause.printStackTrace();
                return JSONResult.error("es删除课程不可用");
            }
        };

    }
}
